package com.hackathon.sgstern.dataprovider;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.hackathon.sgstern.R;
import com.hackathon.sgstern.model.Sports;

public class LogoProvider {

	public static Bitmap retrieveBitmap(Context context, Sports sportType) {
		return BitmapFactory.decodeResource(context.getResources(),
				getResourceId(sportType));
	}

	public static BitmapDescriptor retrieveBitmapDescriptor(Sports sportType) {
		return BitmapDescriptorFactory
				.fromResource(getBlueResourceId(sportType));
	}

	private static int getResourceId(Sports sportType) {
		switch (sportType) {
		case FOOTBALL:
			return R.drawable.fussball;
		case BASKETBALL:
			return R.drawable.basketball;
		case TENNIS:
			return R.drawable.tennis;
		case SQUASH:
			return R.drawable.squash;
		case BADMINTON:
			return R.drawable.badminton;
		case DRACHENBOOT:
			return R.drawable.drachenboot;
		default:
			return R.drawable.defaultsport;
		}
	}

	private static int getBlueResourceId(Sports sportType) {
		switch (sportType) {
		case FOOTBALL:
			return R.drawable.fussballblue;
		case BASKETBALL:
			return R.drawable.basketballblue;
		case TENNIS:
			return R.drawable.tennisblue;
		case SQUASH:
			return R.drawable.squasblue;
		case BADMINTON:
			return R.drawable.badmintonblue;
		case DRACHENBOOT:
			return R.drawable.drachenbootblue;
		default:
			return R.drawable.defaultblue;
		}
	}

	public static Bitmap retrieveProfilePicure(Context context, String nickname) {
		return BitmapFactory.decodeResource(context.getResources(),
				getResourceOfProfilePicture(nickname));
	}

	private static int getResourceOfProfilePicture(String nickname) {
		if ("Messi".equals(nickname)) {
			return R.drawable.messi;
		}
		if ("CR7".equals(nickname)) {
			return R.drawable.cr7;
		}
		if ("Vedad".equals(nickname)) {
			return R.drawable.vedad;
		}
		if ("Mickey Mouse".equals(nickname)) {
			return R.drawable.mickey_mouse;
		}
		if ("Donald Duck".equals(nickname)) {
			return R.drawable.donald_duck;
		}
		if ("Dieter Zetsche".equals(nickname)) {
			return R.drawable.zetsche;
		}
		return R.drawable.ic_action_person;
	}
}
